Skip to content

quic: add support for HTTP/3 datagrams#64234

Open
pimterry wants to merge 1 commit into
nodejs:mainfrom
pimterry:h3-datagram-support
Open

quic: add support for HTTP/3 datagrams#64234
pimterry wants to merge 1 commit into
nodejs:mainfrom
pimterry:h3-datagram-support

Conversation

@pimterry

@pimterry pimterry commented Jul 1, 2026

Copy link
Copy Markdown
Member

With nghttp3 released and updated here, we can now cleanly add proper HTTP/3 datagram support to fix #63891. This PR:

  • Adds stream.sendDatagram and stream.ondatagram support on HTTP/3 streams.
  • Makes the session equivalents throw for HTTP/3 sessions.

The resulting API is a little awkward (both H3 & QUIC methods present everywhere, but throwing in different cases) due to the mixed QUIC/H3 API as already discussed, but I think it's worthwhile opening in the meantime anyway so people can start playing with this, and so we can review it standalone.

The API will conflict with the HTTP/3 split PR that restructures related areas, but the internals should be the same in any case (just moved around) so it'll be easy to slide into whatever final structure we end up with there.

This doesn't support HTTP/3 datagrams for 0RTT on the client side. The RFC would require us to persist the HTTP/3 SETTINGS client-side to validate datagrams are supported to do so, but we currently don't persist HTTP/3 SETTINGS at all. Right now for all HTTP/3 0RTT we're just falling back to the HTTP/3 defaults instead (as allowed by the spec) but the datagram default is off. We could explore that later if we want, but completely rejigging HTTP/3 session resumption to enable this seemed more effort than it's worth for now. Server acceptance of inbound 0RTT datagrams from non-Node clients should work fine but can't be covered in the tests due to this.

Signed-off-by: Tim Perry <pimterry@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 1, 2026
Comment thread src/quic/streams.cc
// A pending stream has no id yet, so there is nothing to bind to.
if (stream->is_pending()) {
return args.GetReturnValue().Set(BigInt::New(env->isolate(), 0));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well for webtransport, it would be the right behavior, to store it in a list (with maximum capaticity). This of course could be done also outside.

@metcoder95 metcoder95 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quic: http/3 datagrams partially diverge from spec

4 participants